<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .outer {
            width: 300px;
            height: 300px;
            background-color: red;
            margin: 0 auto;
            padding: 50px;
            box-sizing: border-box;
        }

        .center {
            width: 200px;
            height: 200px;
            background-color: pink;
            padding: 50px;
            box-sizing: border-box;
        }

        .inner {
            width: 100px;
            height: 100px;
            /* 设置背景渐变色 线性渐变 to right/bottom to right bottom 径向渐变 */
            background-image: linear-gradient(to right bottom, red, pink, blue);
        }
    </style>
</head>

<body>
    <div class="outer">
        <div class="center">
            <div class="inner"></div>
        </div>
    </div>
    <script>
        // 事件冒泡：事件从内向外触发 从最具体的元素（最深的元素）开始触发
        var outer = document.querySelector('.outer');
        var center = document.querySelector('.center');
        var inner = document.querySelector('.inner');
        // target属性和currentTarget属性 ***************
        /**
         * target属性表示事件触发源元素
         * currentTarget 表示当前正在执行事件元素 
        */
        outer.onclick = function () {
            console.log(event.target, 'outer');
            console.log(event.currentTarget, 'outer');
        }
        center.onclick = function () {
            console.log(event.target, 'center');
            console.log(event.currentTarget, 'center');
        }
        inner.onclick = function () {
            console.log(event.target, 'inner');
            console.log(event.currentTarget, 'inner')
        }
    </script>
</body>

</html>